package com.mall.xiaomi.mapper;

import com.mall.xiaomi.pojo.Order;
import com.mall.xiaomi.vo.OrderVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface OrderMapper extends Mapper<Order>{
    /**
     * @Author zhanghui
     * @Description 全查订单信息以及产品名称和图片
     * @Date 2021/2/25 16:59
     * @Param []
     * @return java.util.List<com.mall.xiaomi.vo.OrderVo>
     **/
    @Select("select `order`.*, product.product_name as productName, product.product_picture as productPicture " +
            "from `order`, product where `order`.product_id = product.product_id and `order`.user_id = #{userId} " +
            "ORDER BY `order`.`order_time` DESC")
    public List<OrderVo> findOrders(Integer userId);
//    /**
//     * @Author zhanghui
//     * @Description 添加订单各个信息
//     * @Date 2021/2/26 10:13
//     * @Param [order]
//     * @return int
//     **/
//    @Insert("insert into order values (order_id = #{orderId},user_id = #{userId},product_id = #{productId}" +
//            ",product_num = #{productNum},product_price = #{productPrice} )")
//    public int insert(Order order);

}
